Guest User

Untitled

a guest
Jan 19th, 2012
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int f(int t[], int rozmiar)
  4. {
  5. int t1[rozmiar], i, j, tmp, tmp2=0;
  6. t1[0]=t[0];
  7. for (i=1; i<rozmiar; i++)
  8. {
  9. tmp=0;
  10. for (j=0; j<i; j++)
  11. { if (t[j]==t[i]) tmp=1;}
  12. if (tmp==1) t1[i]=-1;
  13. else t1[i]=t[i];
  14. if (tmp==1) tmp2++;
  15. }
  16. return rozmiar-tmp2;
  17. }
  18.  
  19. int main(void)
  20. {
  21. int tab[1000];
  22. int ilosc;
  23. int i;
  24. printf("Podaj ilosc liczb: ");
  25. scanf("%d", &ilosc);
  26. printf ("Podaj te liczby: ");
  27. for(i=0; i<=ilosc-1; i++)
  28. scanf("%d", &tab[i]);
  29. printf("Wynik: %d", f(tab, ilosc));
  30. getchar ();
  31. getchar ();
  32. return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment